# -*- coding: utf-8 -*-
from .base import Base

from aiosqlite import Connection


class Account(Base("users", ("email", "password", "firstName", "lastName"))):
    id:        int
    email:     str
    password:  str
    firstName: str
    lastName:  str


    @classmethod
    async def get_by_auth(cls, email: str, password: str, database: Connection) -> "Account":
        return await cls.get_by(database, email = email, password = password)


    @property
    def fullName(self):
        return f'{self["firstName"]} {self["lastName"]}'
